<?php

namespace App\Trip\Orders;

use App\Models\Orders\Repositories\Interfaces\OrdersInterface;
use App\Trip\Enums\TripTypes;

class TripOrderStateDesc
{
    static function transDescByOrder(OrdersInterface $order, $language = ''): string
    {
        return self::transDescByOrderState($order->tripType(), $order->getOrderState(), $language);
    }

    static function transDescByOrderState(TripTypes $type, int $order_state, $language = ''): string
    {
        $tag = $type->trip_tag();
        return __("{$tag}/order_state.{$order_state}", [], $language);
    }

    static function transPassengerDescByOrderState(TripTypes $type, int $order_state, $language = ''): string
    {
        $tag                   = $type->trip_tag();
        $trans                 = app('translator')->get('train/order_state', [], $language);
        $passenger_order_state = "passenger_".$order_state;
        if (isset($trans[$passenger_order_state])) {
            $order_state = $passenger_order_state;
        }
        return __("{$tag}/order_state.{$order_state}", [], $language);
    }

    static function transIntroByOrder(OrdersInterface $order, $language = ''): string
    {
        return self::transIntroByOrderState($order->tripType(), $order->getOrderState(), $language);
    }

    static function transIntroByOrderState(TripTypes $type, int $order_state, $language = ''): string
    {
        $tag = $type->trip_tag();
        return __("{$tag}/order_state_introduce.{$order_state}", [], $language);
    }
}